package 第十章;

import java.io.*;
public class test2 {
    public static void main(String[] args) {
        try (FileReader reader = new FileReader("file.txt");
             FileWriter writer = new FileWriter("file1.txt");) {
            BufferedReader br = new BufferedReader(reader);
            BufferedWriter bw = new BufferedWriter(writer);
            String line = null;
            String lineNew = null;
            int lineNum = 1;
            while ((line = br.readLine()) != null) {
                lineNew = lineNum + " " + line;
                bw.write(lineNew);
                bw.newLine();
            }
            br.close();
            bw.close();

        } catch (IOException e) {
            e.fillInStackTrace();
        }
    }
}
